package com.nxy.test.rxjava;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by snailnan on 2017/11/27.
 */
public class MyObserver implements Observer {
    private static final Logger logger = LoggerFactory.getLogger(MyObserver.class);

    @Override
    public void onSubscribe(Disposable d) {
        logger.info("onSubscribe");
    }

    @Override
    public void onNext(Object o) {
        logger.info("onNext");
        logger.info("Object :{}", new Gson().toJson(o));
    }

    @Override
    public void onError(Throwable e) {

    }

    @Override
    public void onComplete() {
        logger.info("onComplete");
    }
}
